﻿using SqlMapper.SqlElements;
using System.Collections.Specialized;
using System.Xml;

namespace SqlMapper.Serializers
{
    public sealed class IsEqualDeSerializer : IDeSerializer
    {
        public BaseTag Deserialize(XmlNode node)
        {
            IsEqual isEqual = new IsEqual();

            NameValueCollection prop = NodeUtils.ParseAttributes(node);
            isEqual.Prepend = NodeUtils.GetStringAttribute(prop, "prepend");
            isEqual.Property = NodeUtils.GetStringAttribute(prop, "property");
            isEqual.CompareProperty = NodeUtils.GetStringAttribute(prop, "compareProperty");
            isEqual.CompareValue = NodeUtils.GetStringAttribute(prop, "compareValue");
            isEqual.Sql = NodeUtils.GetStringAttribute(prop, "sql");

            return isEqual;
        }
    }
}
